package com.boc.langxiang.presenter.me;

import android.support.v4.app.FragmentManager;

import com.boc.langxiang.contract.me.AllOrdersActivityContract;
import com.boc.langxiang.ui.adapter.me.OrdersAllPagerAdapter;
import com.boc.langxiang.ui.fragment.BaseFragment;
import com.boc.langxiang.ui.fragment.me.OrdersAllFragment;
import com.boc.langxiang.ui.fragment.me.OrdersReturnProductFragment;
import com.boc.langxiang.ui.fragment.me.OrdersWaitDeliveryFragment;
import com.boc.langxiang.ui.fragment.me.OrdersWaitPayFragment;
import com.boc.langxiang.ui.fragment.me.OrdersWaitReceiveFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by admin on 2016/6/23.
 */
public class OrdersAllActivityPresenter implements AllOrdersActivityContract.Presenter {

    private List<BaseFragment> mList;
    private OrdersAllPagerAdapter mAdapter;
    private AllOrdersActivityContract.View mView;

    public OrdersAllActivityPresenter(AllOrdersActivityContract.View view) {
        this.mView = view;
    }


    public void initFragmentList() {

        if (mList == null) {
            mList = new ArrayList<>();
        }
        mList.clear();
        mList.add(OrdersAllFragment.getInstance());
        mList.add(OrdersWaitPayFragment.getInstance());
        mList.add(OrdersWaitDeliveryFragment.getInstance());
        mList.add(OrdersWaitReceiveFragment.getInstance());
        mList.add(OrdersReturnProductFragment.getInstance());
    }

    public void initAdapter(FragmentManager supportFragmentManager) {
        mAdapter = new OrdersAllPagerAdapter(supportFragmentManager, mList);
        mView.setAdapter(mAdapter);
    }
}
